package com.heima.controller;


import com.heima.pojo.dto.VendingMachineDto;
import com.heima.pojo.dto.VendingMachineSearchDto;
import com.heima.pojo.vo.VendingMachineSearchVo;
import com.heima.service.VendingMachineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ljk
 * @since 2024-10-23
 */
@RestController
@RequestMapping("/api/vm-service/vm")
@Slf4j
@Api(tags = "设备相关接口")
@RequiredArgsConstructor
public class VendingMachineController {
    private final VendingMachineService vmService;

    @GetMapping("/search")
    @ApiOperation("设备搜索")
    public VendingMachineSearchVo pageQuery(VendingMachineSearchDto dto){
        return vmService.pageQuery(dto);
    }

    @PostMapping
    @ApiOperation("新增设备")
    public Boolean addVM(@RequestBody VendingMachineDto dto){
        vmService.addVM(dto);
        return true;
    }

}
